@extends('shop_admin.admin')

@section('content')
    <link rel="stylesheet" href="/components/AdminLTE/plugins/daterangepicker/daterangepicker-bs3.css">

<!-- date-range-picker -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
<script src="/components/AdminLTE//plugins/daterangepicker/daterangepicker.js"></script>
        <!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        订单管理
        <small>订单列表</small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="/shop_admin"><i class="fa fa-dashboard"></i> 控制面板</a></li>
        <li ><a href="/shop_admin/order">订单管理</a></li>
        <li class="active">订单列表</li>
    </ol>
</section>

<!-- Main content -->
<section class="content">

    <div class="row">
        <div class="col-xs-12">

            <div class="box box-primary ">
                <div class="box-body table-responsive">

                    {!! Form::model(@$orderInfo,array('route' => 'shop_admin.order.index','method' => 'get','class'=>'form-search form-inline')) !!}
                    <div class="form-group">
                            {!! Form::text('order_sn',@$_GET['order_sn'],array('class'=>'form-control ','placeholder'=>'订单号'))!!}
                    </div>
                    <div class="form-group">
                        {!! Form::text('consignee',@$_GET['consignee'],array('class'=>'form-control','placeholder'=>'收货人'))!!}
                    </div>
                    <div class="form-group">
                        {!! Form::text('mobile',@$_GET['mobile'],array('class'=>'form-control','placeholder'=>'收货人电话'))!!}
                    </div>
                    <div class="form-group">
                        {!! Form::select('order_price',[
                        'All'=>'全部价格范围',
                        '0-500'=>'0-500',
                        '500-1000'=>'500-1000',
                        '1000-'=>'1000以上',
                        ],$filter['order_price'],['class'=>'form-control','placeholder'=>'ssss'])!!}
                    </div>
                    <div class="form-group">
                        {!! Form::select('order_type',[
                        'ALL'=>'类型',
                        'E'=>'外贸',
                        'C'=>'普通',
                        ],$filter['order_type'],['class'=>'form-control','placeholder'=>'ssss'])!!}
                    </div>

                    <div class="form-group">
                        {!! Form::select('order_status',$orderStatusArr,$filter['order_status'],['class'=>'form-control','placeholder'=>'ssss'])!!}
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <button type="button" class="btn btn-default pull-right" id="daterange-btn">
                                <i class="fa fa-calendar"></i> <span class="show-span">下单时间</span>
                                <i class="fa fa-caret-down"></i>
                            </button>
                            {!! Form::hidden('time',@$_GET['time'],array('class'=>'form-control','placeholder'=>'收货人','id'=>'time'))!!}

                        </div>
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-primary " ><i class="fa  fa-filter"></i>筛选</button>
                        <a href="/shop_admin/order?order_sn=&consignee=&has_eorder=ALL&pay_status=ALL" class="btn btn-default">重置</a>
                    </div>
                    {!! Form::close() !!}
                </div>

            </div><!-- end .box box-primary -->

            <div class="box box-primary">


                <div class="box-header">
                    <h3 class="box-title">订单列表</h3>
                    
                </div>
                <!-- /.box-header -->
                <div class="box-body table-responsive no-padding">
                    <table class="table table-hover">
                        <tr>
                            <th style="width: 100px;">订单编号</th>
                            <th style="width: 100px;">收货人</th>
                            <th>状态</th>
                            <th>类型</th>
                            <th>商品价格</th>
                            <th>邮费</th>
                            <th>订单价格</th>
                            <th style="width: 160px;">下单时间</th>

                            <th style="width: 150px;">操作</th>

                        </tr>
                        @foreach ($orderInfo as $order)
                        <tr>
                            <td>{{$order->order_sn}}</td>
                            <td>{{$order->consignee}}</td>
                            <td>{{@$orderStatusArr[$order->order_status]}}</td>
                            <td>{{@$typeArr[$order->order_type]}}</td>
                            <td>{{number_format($order->order_price,2)}}</td>
                            <td>{{number_format($order->shipping_fee,2)}}</td>
                            <td>{{number_format($order->pay_price,2)}}</td>
                            <td>{{$order->add_time}}</td>


                            <td>
                                <a href="/shop_admin/order/{{$order->order_id}}?back_url=<?php echo urlencode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);?>" type="button" class="btn  btn-default btn-xs">
                                    <i class="glyphicon glyphicon-eye-open"></i>&nbsp;订单详情
                                </a>
                            </td>
                        </tr>
                        @endforeach

                    </table>
                </div>
                <!-- /.box-body -->

                <div class="box-footer">
                    <!-- 分页 -->
                    <div class="pull-right no-margin-pager">
                        {!! $orderInfo->appends($filter)->render() !!}
                    </div>

                    <a href="{{$downloadUrl}}" type="submit" class="btn btn-default pull-right-" ><i class="fa  fa-download"></i>&nbsp;导出</a>

                </div>
            </div>
            <!-- /.box -->
        </div>
    </div>
</div>


</section>

<script>
    var daterRange=$('#daterange-btn'),input=$('#time'),getTime=input.val();

    utils.datePredefinedRanges(daterRange,input,getTime);
</script>
<!-- /.content -->
@endsection